﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;
using EasyBuy.Model;
using System.Data;


namespace EasyBuy.DAL
{
    /// <summary>
    /// 用户表数据访问类
    /// By:田玉粮
    /// 2012-7-15
    /// </summary>
    public class UserService
    {
        #region 成员
        /// <summary>
        /// SQL语句：查询所有用户信息
        /// </summary>
        static readonly String Select_User_All = "select eu_user_id,eu_user_name,eu_password,eu_sex,eu_birthday,eu_identity_code,eu_email,eu_mobile,eu_mobile,eu_status from easybuy_user";
        #endregion

        #region 方法
        /// <summary>
        /// 读取所有用户 , 返回Dataset
        /// </summary>
        /// <returns>DataSet</returns>
        public DataSet readAllUser()
        {
            return SqlHelper.ExecuteDataset(EasyBuyUntil.GetEasyBuyConnString, CommandType.Text, Select_User_All);
        }

        /// <summary>
        /// 未完成，插入用户表数据
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool InsertUser(USER user)
        {
            int numTemp = SqlHelper.ExecuteNonQuery(EasyBuyUntil.GetEasyBuyConnString, "sp_insert_user");
            return numTemp >= 0 ? true : false;
        }

        #endregion

    }

}
